import { createRouter, createWebHashHistory } from "vue-router"
// createRouter 用于创建路由的实例对象
// createWebHashHistory 用于指定路由的工作模式 (hash 模式)

// 创建路由实例对象
const router = createRouter({
    // 指定路由工作模式
    history: createWebHashHistory(),
    // 定义 hash 与组件之间的对应关系
    routes: [
        { path: '/', redirect: '/layout' },
        {
            path: '/layout',
            component: () => import('@/views/Layout.vue'),
            redirect: '/layout/home1',
            children: [
                { path: 'home1', component: () => import('@/views/Home1.vue') },
                { path: 'home2', component: () => import('@/views/Home2.vue') },
                { path: 'home3', component: () => import('@/views/Home3.vue') },
                { path: 'home4', component: () => import('@/views/Home4.vue') },
                { path: 'home5', component: () => import('@/views/Home5.vue') },
            ]
        },

    ]
})

// 向外共享路由模块
export default router
